#include <iostream>
#include <cmath>

using namespace std;

class Solution {
public:
    int countDigitOne(int n) {
        if (n <= 0) {
            return 0;
        } else if (n <= 9) {
            return 1;
        }
        int pos = 0;
        int val = 0;
        int ans = 0;
        while (n != 0) {
            int last_val = n % 10;
            n /= 10;
            if (last_val == 0) {
                ans += n * pow(10, pos);
            } else if (last_val == 1) {
                ans += n * pow(10, pos) + (val + 1);
            } else {
                ans += (n + 1) * pow(10, pos);
            }
            val = last_val * pow(10, pos) + val;
            pos++;
        }
        return ans;
    }
};

int main() {
    Solution solution;
    int output = solution.countDigitOne(280);
    cout << output << endl;
    return 0;
}